Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v2] feat(pagination): add async pagination #2464

Closed
wants to merge 2 commits into from

Conversation

TheSharpieOne
Copy link
Contributor

@TheSharpieOne TheSharpieOne commented Mar 25, 2018

Just like #1237, but for v2.

This adds a new pagination prop to the Select.Aync component. It is a boolean which is false by default (false: things act as they did before it was added). When pagination is true loadOptions is given an additional argument; page.
page tells the user's loadOptions function which page to load (they can use to when building their request). Additional page results are appended to the options list. Changing the input value will reset the page back to 1.
loadOptions is called when the user scrolls to the bottom of the menu list, trigger the next page of results to be appended.
Caching is used! (Cache all the things!). If a user scrolls down enough to load additional pages, then changes the input (triggering new requests), then enters the original input, all of the pages for the original input will be loaded back and when the user scroll to the bottom again, it will pick up on the page it left off on.

react-select-v2-async-pagination

@TheSharpieOne TheSharpieOne changed the title feat(pagination): add async pagination [v2] feat(pagination): add async pagination Mar 25, 2018
@TheSharpieOne TheSharpieOne force-pushed the v2-async-pagination branch 3 times, most recently from 6130c15 to cfe56a4 Compare March 30, 2018 19:39
@TheSharpieOne
Copy link
Contributor Author

Rebased. v2's tests are currently failing and now this branch will too :D

@patrickomeara
Copy link

patrickomeara commented Apr 30, 2018

Nice work @TheSharpieOne, you're all over it. @JedWatson let me know if you need any help maintaining this package.

@ketysek
Copy link

ketysek commented Jul 14, 2018

When this will be merged? :)

@matheusdsmartins
Copy link

Would love to see this merged as soon as possible!

@renanrboliveira
Copy link

+1

@JohnDDuncanIII
Copy link

My company is using a fork of v1.0.0-rc.3 w/ #1237 merged in due to this ongoing bug. Please please please merge this ;_; It would make my job a lot easier

@TheSharpieOne
Copy link
Contributor Author

TheSharpieOne commented Aug 17, 2018

Just FYI my changes have been published to @thesharpieone/react-select-async-pagination
It's based off v2.0.0 (official, not beta) so you get all of the v2.0.0 goodness plus the changes from this PR.

Also, the Async component is pretty simple (mostly managing cache and calling a user defined function to get the options), this could definitely be a third-party package which uses react-select under the hood so that this feature doesn't need to be in the "core" package.

@jelteliekens
Copy link

@TheSharpieOne Is there any chance this gets merged soon? It's a nice feature I would like to use in my project.

@TheSharpieOne
Copy link
Contributor Author

@jelteliekens it's not up to me.

@mtunski
Copy link

mtunski commented Oct 30, 2018

Can't wait :3

@duongnhatduy
Copy link

+1

@dbenchi
Copy link

dbenchi commented Dec 21, 2018

I just want to know the main reason behind blocking this PR?
Just want to know whether it is performance issue? hidden bugs? etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.